Fix seg fault caused by stale particle indices after coalescence from HF decays - #2416
Fix seg fault caused by stale particle indices after coalescence from HF decays#2416alcaliva wants to merge 2 commits into
Conversation
|
REQUEST FOR PRODUCTION RELEASES: This will add The following labels are available |
|
Hi @sawenzel , @jackal1-66 , @fgrosa , |
|
I think I found the reason why the code crashes only for deuterons, while it works fine for ^3He. In the case of deuteron production, the same nucleon can satisfy the coalescence condition with more than one partner. Since, at every successful coalescence, doCoal() replaces one particle and removes the remaining nucleons from the event record, the precomputed particle index lists become invalid for the subsequent loops. I added a return immediately after a successful coalescence in the decay mode. The standard event-wide coalescence workflow remains unchanged. |
Fix a segmentation fault in the coalescence afterburner by returning immediately after successful coalescence in a heavy-hadron decay. When coalescence occurs, one or more nucleons are removed from the event, invalidating the stored particle indices. If the loops continue, the code may attempt to access an invalid index and crash.
This PR proposes a minimal fix for the analysis of deuterons from Λb decays, but the same fix should probably be applied to all occurrences.
@fgrosa , @MRazza879